<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('攻击评估列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>

                        <li>
                            <p>测评名称：</p>
                            <input type="text" placeholder="请输入测评名称" name="aTitle"/>
                        </li>

                        <li>
                            <p>测评时间：</p>
                                <input name="params[aTime]" readonly data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss" placeholder="" class="form-control time-input-two" type="text" maxlength="30" required>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:attack:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:attack:remove')}]];
    var prefix = ctx + "system/attack";
    var datas = [[${@dict.getType('attack_type')}]];
    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            infoUrl: prefix + "/info/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "测评",

            showRefresh: false,
            showToggle: false,
            showColumns: false,
            showSearch: false,
            sortName:'createTime',
            sortOrder:'desc',
            columns: [{
                checkbox: true
            },
                {
                    field: 'aId',
                    title: '评估ID',
                    visible: false
                },
                {
                    field: 'aTitle',
                    title: '测评名称'
                },
                {
                    field: 'aType',
                    title: '攻击类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                {
                    field: 'aTime',
                    title: '时间段'
                },
                {
                    field: 'createTime',
                    title: '测评时间',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="info(\'' + row.aId + '\')"><i class="fa fa-info"></i>详情</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.aId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function info(id) {
        table.set();
        $.modal.openTab("评估详情", ctx + "system/attack/info/" + id);
    }

</script>
</body>
</html>